﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Portal/CustomerPortal.Master" AutoEventWireup="true" CodeBehind="ServiceList.aspx.cs" Inherits="TireService.Business.Portal.ServiceView.ServiceList" %>

<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1.Export, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <table cellpadding="0" cellspacing="2" border="0">
        <tr>
            <td>
                <img id="imgCar" alt="" src="~/Images/Medium/nut_and_bolt.png" runat="server" style="width: 32px; height: 32px" />
            </td>
            <td valign="middle">
                <h3><asp:Label ID="lblServiceListHeader" runat="server" Text="Hjulskift"></asp:Label></h3>
            </td>
        </tr>
    </table>
    <hr />
    
    <!-- Javascript of action dropdown list -->
    <script language="javascript" type="text/javascript">

        // Function that handles actions selected in dropdown list
        function ActionClicked() {

            // Get selected action from dropdownlist
            var id = ddlAction.GetValue();

            if (id != null && id != 0) {


            }
            else {
                alert('Ingen handling valgt');
            }
        }

    </script>

    <table border="0" cellspacing="0" cellpadding="5" width="100%">
        <tr>
            <td style="width:150px">
                <dx:ASPxComboBox ID="ddlAction" ClientInstanceName="ddlAction" runat="server" Width="150px">
                    <Items>
                        <dx:ListEditItem Selected="true" Value="0" Text="-- Handling --" />
                    </Items>
                </dx:ASPxComboBox>
            </td>
            <td style="width:75px">
                <dx:ASPxButton ID="btnSubmitAction" runat="server" Text="Udfør" AutoPostBack="False" UseSubmitBehavior="False" Width="75px">
                    <ClientSideEvents Click="function(s, e) { ActionClicked(); }" />
                </dx:ASPxButton>
            </td>
            <td style="width:150px">
                <dx:ASPxComboBox ID="ddlExport" ClientInstanceName="ddlExport" runat="server" Width="150px">
                    <Items>
                        <dx:ListEditItem Selected="True" Value="0" Text="Export pdf" />
                        <dx:ListEditItem Value="1" Text="Export xls" />
                        <dx:ListEditItem Value="2" Text="Export csv" />
                        <dx:ListEditItem Value="3" Text="Export rtf" />
                    </Items>
                </dx:ASPxComboBox>
            </td>
            <td style="width:75px">
                <dx:ASPxButton ID="btnExport" runat="server" Text="Exporter" OnClick="btnExport_Click" Width="75px" >
                </dx:ASPxButton>
            </td>
            <td align="right">
                <asp:Label ID="lblView" runat="server" Text="Visning"></asp:Label>
                <asp:DropDownList ID="ddlView" runat="server" AutoPostBack="True" 
                    onselectedindexchanged="ddlView_SelectedIndexChanged">
                    <asp:ListItem Value="0">Ingen gruppering</asp:ListItem>
                    <asp:ListItem Value="1">Grupper efter Bil</asp:ListItem>
                    <asp:ListItem Value="2">Grupper efter Dato</asp:ListItem>
                    <asp:ListItem Value="3">Grupper efter Gennemført</asp:ListItem>
                    <asp:ListItem Value="4">Grupper efter Afdeling/Kontakt</asp:ListItem>
                </asp:DropDownList>
                &nbsp;
                <asp:Label ID="lblPageSize" runat="server" Text="Antal linjer pr side"></asp:Label>
                <asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="true">
                    <asp:ListItem Value="10">10</asp:ListItem>
                    <asp:ListItem Value="25">25</asp:ListItem>
                    <asp:ListItem Value="50">50</asp:ListItem>
                    <asp:ListItem Value="100">100</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
    </table>
    <hr />          
    
    <dx:ASPxGridView ID="gvService" runat="server" ClientInstanceName="gvService" Width="100%"
        KeyFieldName="ServiceCarScheduleDetailId" AutoGenerateColumns="False" EnableCallBacks="True">
        <SettingsLoadingPanel Text="Henter&amp;hellip;" />
        <Settings ShowHeaderFilterButton="true" ShowGroupPanel="true" ShowFilterRow="True" />
        <SettingsPager AlwaysShowPager="True" PageSize="20" Position="TopAndBottom">
            <Summary 
                AllPagesText="Sider: {0} - {1} ({2} hjulskift)" 
                Text="Side {0} af {1} ({2} hjulskift)" />
        </SettingsPager>
        <SettingsBehavior ConfirmDelete="True" AllowGroup="true" AllowDragDrop="true" />
        <Columns>
            <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                    <HeaderTemplate>
                        <input type="checkbox" onclick="gvService.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Vælg/Fravælg alle linjer på siden"></input>
                    </HeaderTemplate>
                    <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" 
                        HorizontalAlign="Center">
                    <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                    </HeaderStyle>
            </dx:GridViewCommandColumn>

            <dx:GridViewDataHyperLinkColumn FieldName="CustomerId" VisibleIndex="5" Caption="Kontakt">
                <PropertiesHyperLinkEdit NavigateUrlFormatString="~/Portal/CustomerView/CustomerData.aspx?CustomerId={0}" TextField="Name">
                </PropertiesHyperLinkEdit>
            </dx:GridViewDataHyperLinkColumn>
            <dx:GridViewDataColumn FieldName="Name" VisibleIndex="5" Caption="Kontakt" Visible="false">
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="ScheduleDate" VisibleIndex="6" Caption="Dato">
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="RegistrationNumber" VisibleIndex="6" Caption="Reg.nr.">
            </dx:GridViewDataColumn>
            <dx:GridViewDataTextColumn FieldName="CarBrandDescription" VisibleIndex="7" Caption="Bilmærke">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="FromTireSetDescription" VisibleIndex="7" Caption="Fra">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="ToTireSetDescription" VisibleIndex="7" Caption="Til">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataCheckColumn FieldName="CustomerConfirmed" VisibleIndex="13" Caption="Godkendt">
            </dx:GridViewDataCheckColumn>
            <dx:GridViewDataCheckColumn FieldName="WorkCompleted" VisibleIndex="13" Caption="Gennemført">
            </dx:GridViewDataCheckColumn>
            <dx:GridViewDataCheckColumn FieldName="CustomerRated" VisibleIndex="13" Caption="Anmeldt">
            </dx:GridViewDataCheckColumn>
        </Columns>                                            
    </dx:ASPxGridView>
                                
    <dx:ASPxGridViewExporter ID="gvExport" runat="server" GridViewID="gvService">
    </dx:ASPxGridViewExporter>

</asp:Content>
